package com.weixin.paleituo.view;


import android.content.Context;

import com.yanyusong.y_divideritemdecoration.Y_Divider;
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder;
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration;

import java.util.List;

/**
 * Author yichao
 * Time  2018/4/3 15:48
 * Dest  首页
 */

public class HomeDividerItemDecoration extends Y_DividerItemDecoration {
    private List<Object> mObjects;

    public HomeDividerItemDecoration(Context context, List objects) {
        super(context);
        mObjects = objects;
    }

    @Override
    public Y_Divider getDivider(int itemPosition) {
        Y_Divider divider = null;

        if (itemPosition == 0) {
            divider = new Y_DividerBuilder()
                    .setRightSideLine(false, 0xff666666, 10, 0, 0)
                    .setBottomSideLine(false, 0xff666666, 20, 0, 0)
                    .create();

        } else if (itemPosition == mObjects.size() + 1) {
            divider = new Y_DividerBuilder()
                    .setRightSideLine(false, 0xff999999, 10, 0, 0)
                    .setBottomSideLine(false, 0xff999999, 20, 0, 0)
                    .create();
        } else {

            if (itemPosition % 2 == 0) {
                divider = new Y_DividerBuilder()
                        .setRightSideLine(true, 0xffffffff, 20, 0, 0)
                        .setBottomSideLine(true, 0xffffffff, 20, 0, 0)
                        .create();
            } else {
                divider = new Y_DividerBuilder()
                        .setRightSideLine(true, 0xffffffff, 20, 0, 0)
                        .setBottomSideLine(true, 0xffffffff, 20, 0, 0)
                        .setLeftSideLine(true, 0xffffffff, 20, 0, 0)
                        .create();
            }


        }


        return divider;
    }
}
